package com.bawei.house

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.bawei.base.mvvm.BaseActivity
import com.bawei.house.adapter.LesseeAdapter
import com.bawei.house.databinding.ActivityLesseeBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = "/house/LesseeActivity")
class LesseeActivity : BaseActivity<ActivityLesseeBinding,HouseViewModel>() {
    lateinit var lesseeAdapter: LesseeAdapter
    override fun initView() {
        viewModel.house()
        lesseeAdapter=LesseeAdapter()
        binding.lesseeRec.adapter=lesseeAdapter
        binding.lesseeRec.layoutManager=LinearLayoutManager(this)
    }

    override fun initData() {
        viewModel.houseSuccess.observe(this){
            lesseeAdapter.data.clear()
            lesseeAdapter.data.addAll(it)
            lesseeAdapter.notifyDataSetChanged()
        }

    }
}